<template>
  <div>
    <div id="header">
      <a href="/" id="logo">
        <span>HopeMa</span>
      </a>
      <ul id="nav">
        <li v-for="title in headerTitle"><router-link :to="title.href">{{title.name}}</router-link><!--<a :href="'/'+title.href">{{title.name}}</a>--></li>
      </ul>
    </div>
    <div id="mobile-bar" class="top">
      <a class="menu-button"></a>
    </div>
  </div>

</template>

<script>
export default {
  name: 'nav',
  data () {
    return {
      headerTitle: [
          {href: 'ai', name: '人工智能学习'},
          {href: 'frontend', name: '前端学习'},
          {href: 'backend', name: '后端学习'},
          {href: 'soft', name: '软件学习'},
          {href: 'photo', name: '摄影学习'},
          {href: 'literature', name: '文学学习'}
      ]
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
  #mobile-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background-color: #fff;
    z-index: 9;
    display: none;
    box-shadow: 0 0 2px rgba(0,0,0,0.25);
    .menu-button {
      position: absolute;
      width: 24px;
      height: 24px;
      top: 8px;
      left: 12px;
      background: url("../assets/menu.png") center center no-repeat;
      background-size: 24px;
    }
    /*.logo {*/
       /*position: absolute;*/
       /*width: 30px;*/
       /*height: 30px;*/
       /*background: url("../images/logo.png") center center no-repeat;*/
       /*top: 5px;*/
       /*left: 50%;*/
       /*margin-left: -15px;*/
       /*background-size: 30px;*/
     /*}*/
  }

  #header{
    position: fixed;
    width: 100%;
    top: 0;
    box-shadow:0 0 1px rgba(0,0,0,0.25);
    transition:background-color 0.3s ease-in-out;
    background-color: #fff;
    background: linear-gradient(to left, rgba(68,158,68,0.6), rgba(68,158,68,0.9)); /* 标准的语法（必须放在最后） */
    padding: 10px 60px;
    text-align: left;
    #logo{
      display: inline-block;
      font-size: 1.5em;
      line-height:40px;
      color: #fff;
      font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
      font-weight: 500;
    }
    #nav{
      position: fixed;
      list-style-type: none;
      margin: 0;
      padding: 0;
      /*position: absolute;*/
      right: 60px;
      top: 10px;
      height: 40px;
      line-height: 40px;
      li{
        display: inline-block;
        position: relative;
        margin: 0 0.6em;
        /*display: list-item;*/
        text-align: -webkit-match-parent;
      }
      a {
        color: #fff;
        text-decoration: none;
        line-height:normal;
      }

      a:hover {
        color: #000;
      }

      li a {
        display: block;
        /*font-size: 20px;*/
        text-align: center;
        /*padding: 10px 15px;*/
      }

      li a:hover {
        /*transform: rotate(5deg) scale(1.1);*/
        transform: rotate(0deg) scale(1.1);
      }

      li a:hover:before, li a:hover:after{
        transition: all 0.5s ease;
        opacity: 1;
        width: 30px;
      }

      li a:before, li a:after {
        opacity: 0;
        border-top: 1px solid #000;
        content: '';
        display: block;
        position: relative;
        z-index: -1;
        margin: auto;
        width: 0px;
      }

      li a:before {
        top: 0px;
        /*transform: rotate(120deg) translateY(-50%) translateX(-50%);*/
        transform: rotate(0deg) translateY(-50%) translateX(-50%);
      }

      li a:after {
        top: 0px;
        /*transform: rotate(-60deg) translateY(-50%) translateX(-50%);*/
        transform: rotate(-180deg) translateY(-50%) translateX(-50%);
      }
    }
  }
  @media screen and (max-width: 900px) {
    .sidebar {
      position: fixed;
      z-index: 8;
      background-color: #f9f9f9;
      height: 100%;
      top: 0;
      left: 0;
      padding: 60px 30px 20px;
      box-shadow: 0 0 10px rgba(0,0,0,0.2);
      box-sizing: border-box;
      transition: all 0.4s cubic-bezier(0.4, 0, 0, 1);
      -webkit-transform: translate(-280px, 0);
      transform: translate(-280px, 0);
    }
    .sidebar .search-query {
      width: 200px;
      margin-bottom: 10px;
    }
    .sidebar .main-menu {
      display: block;
    }
    .sidebar.open {
      -webkit-transform: translate(0, 0);
      transform: translate(0, 0);
    }
  }
  @media screen and (max-width: 900px) {
    body {
      -webkit-text-size-adjust: none;
      font-size: 14px;
    }
    .sidebar {
      display: block;
    }
    #header {
      display: none;
    }
    #mobile-bar {
      display: block;
    }
    #hero {
      padding: 50px 40px 30px;
    }
    #hero .hero-logo {
      float: none;
      margin: 30px 0 15px;
      width: 140px;
      height: 140px;
    }
    #hero .left,
    #hero .right {
      text-align: center;
      width: 100%;
    }
    #hero h1 {
      font-size: 2em;
    }
    #hero h2 {
      display: block;
    }
    #hero .button {
      font-size: 0.9em;
    }
    #highlights .point {
      display: block;
      margin: 0 auto;
      width: 300px;
      padding: 0 40px 30px;
    }
    #highlights .point:before {
      content: "—";
      color: #42b983;
    }
  }
</style>
